from pydantic import BaseModel, Field
from typing import Optional
from fastapi import Query


class StaffQuery(BaseModel):
    """业务员查询参数模型"""
    page: int = Field(1, ge=1, description="页码", alias="current")
    size: int = Field(10, ge=1, le=100, description="每页数量")
    name: Optional[str] = Field(None, description="姓名")
    department: Optional[str] = Field(None, description="所属事业部")
    type: Optional[str] = Field(None, description="类型")
    pm: Optional[str] = Field(None, description="PM")
    status: Optional[str] = Field(None, description="状态")
    supervisor: Optional[str] = Field(None, description="主管")
    is_supervisor: Optional[str] = Field(None, description="是否主管(Y/N)")
    third_department: Optional[str] = Field(None, description="三级部门")
    industry: Optional[str] = Field(None, description="行业")
    keyword: Optional[str] = Field(None, description="关键词搜索")


def staff_list_query(
    page: int = Query(1, ge=1, description="页码"),
    size: int = Query(10, ge=1, le=100, description="每页数量"),
    name: Optional[str] = Query(None, description="姓名筛选"),
    department: Optional[str] = Query(None, description="所属事业部筛选"),
    type: Optional[str] = Query(None, description="类型筛选"),
    pm: Optional[str] = Query(None, description="PM筛选"),
    status: Optional[str] = Query(None, description="状态筛选"),
    supervisor: Optional[str] = Query(None, description="主管筛选"),
    is_supervisor: Optional[str] = Query(None, description="是否主管(Y/N)"),
    third_department: Optional[str] = Query(None, description="三级部门筛选"),
    industry: Optional[str] = Query(None, description="行业筛选"),
    keyword: Optional[str] = Query(None, description="关键词搜索"),
) -> StaffQuery:
    """封装业务员列表查询参数为 StaffQuery 模型"""
    return StaffQuery(
        page=page,
        size=size,
        name=name,
        department=department,
        type=type,
        pm=pm,
        status=status,
        supervisor=supervisor,
        is_supervisor=is_supervisor,
        third_department=third_department,
        industry=industry,
        keyword=keyword,
    )